﻿using FinancialBook.Core.Service;
using FinancialBook.Models;
using MvvmCross.Platform;
using MvvmCross.Platform.IoC;

namespace FinancialBook.Core
{
    public class App : MvvmCross.Core.ViewModels.MvxApplication
    {
        public override void Initialize()
        {
            CreatableTypes()
                .EndingWith("Service")
                .AsInterfaces()
                .RegisterAsLazySingleton();

            Mvx.RegisterType<IRepository<Category>, Repository<Category>>();
            Mvx.RegisterType<ICategoryRepository, CategoryRepository>();

            Mvx.RegisterType<IRepository<Transaction>, Repository<Transaction>>();
            Mvx.RegisterType<ITransactionRepository, TransactionRepository>();

            RegisterAppStart<ViewModels.TransactionViewModel>();
        }
    }
}